package EnumTest;

public enum EnumTest {
    RED("RED",1),
    YELLOW("YELLOW",2),
    BLUE("BLUE",3);

    private String coler;
    private int number;
    EnumTest(String color,int number){
        this.coler = color;
        this.number = number;
    }
    public static EnumTest getEnum(int number){
        for (EnumTest t: EnumTest.values()) {
            if (t.number==number){
                return t;
            }
        }
        return null;
    }

    public static void main(String[] args) {
        System.out.println(getEnum(2));
    }
}
